package com.xywang.dao.provider;

import com.xywang.pojo.Provider;
import org.mybatis.spring.SqlSessionTemplate;
import org.springframework.beans.factory.annotation.Autowired;

import java.util.List;

public class ProviderDaoImpl implements ProviderDao{
    private SqlSessionTemplate sqlSessionTemplate;
    @Autowired
    public void setSqlSessionTemplate(SqlSessionTemplate sqlSessionTemplate) {
        this.sqlSessionTemplate = sqlSessionTemplate;
    }

    @Override
    public List<Provider> getProviderListDao(String proCode, String proName) {
        return sqlSessionTemplate.getMapper(ProviderDao.class).getProviderListDao(proCode,proName);
    }

    @Override
    public int addProDao(Provider provider) {
        return sqlSessionTemplate.getMapper(ProviderDao.class).addProDao(provider);
    }

    @Override
    public int deleteProviderById(int delId) {
        return sqlSessionTemplate.getMapper(ProviderDao.class).deleteProviderById(delId);
    }

    @Override
    public Provider getProviderById(int id) {
        return sqlSessionTemplate.getMapper(ProviderDao.class).getProviderById(id);
    }

    @Override
    public int modifyDao(Provider provider) {
        return sqlSessionTemplate.getMapper(ProviderDao.class).modifyDao(provider);
    }
}
